<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../print.css" type="text/css" media="print">
<meta content="Compiler,mathlib.expr.Compiler,compile,compileTokenArray,compileParseTree" name="keywords">
<title>mathlib.expr.Compiler</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
				asdocTitle = 'Compiler - API Documentation';
				var baseRef = '../../';
				window.onload = configPage;
			--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">flashgraph API Documentation</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../all-classes.html')" href="../../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../all-classes.html')" href="../../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../index-list.html')" href="../../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../../index.html?mathlib/expr/Compiler.html&amp;mathlib/expr/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Class&nbsp;Compiler</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#methodSummary">Methods</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class Compiler"); titleBar_setSubNav(false,false,false,false,false,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">mathlib.expr</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class Compiler</td>
</tr>
</table>
<p></p> 
 Converts strings, ParseTrees, or Token arrays into usable CompiledFns.
 <p></p>
<br>
<hr>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#compile()">compile</a>(env:<a href="Environment.html">Environment</a>, s:String, optimize:Boolean = true):<a href="../expr/CompiledFn.html">CompiledFn</a>
</div>
<div class="summaryTableDescription">[static]
  Compile a string into an evaluable CompiledFn.</div>
</td><td class="summaryTableOwnerCol">Compiler</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#compileParseTree()">compileParseTree</a>(env:<a href="Environment.html">Environment</a>, pt:<a href="datatype/ParseTree.html">ParseTree</a>, optimize:Boolean = true):<a href="../expr/CompiledFn.html">CompiledFn</a>
</div>
<div class="summaryTableDescription">[static]
  Compile a ParseTree (generated by the Parser) into an evaluable
  CompiledFn.</div>
</td><td class="summaryTableOwnerCol">Compiler</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#compileTokenArray()">compileTokenArray</a>(env:<a href="Environment.html">Environment</a>, tokens:Array, optimize:Boolean = true):<a href="../expr/CompiledFn.html">CompiledFn</a>
</div>
<div class="summaryTableDescription">[static]
  Compile an array of Tokens (generated by the Lexer) into an evaluable
  CompiledFn.</div>
</td><td class="summaryTableOwnerCol">Compiler</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="compile()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">compile</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>public static function compile(env:<a href="Environment.html">Environment</a>, s:String, optimize:Boolean = true):<a href="../expr/CompiledFn.html">CompiledFn</a></code><p>
  Compile a string into an evaluable CompiledFn.
  </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">env</span>:<a href="Environment.html">Environment</a></code> &mdash; The Environment to use for lookups of functions, operators,
   constants, and variable names.
  </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">s</span>:String</code> &mdash; The expression string to tokenize, parse, and compile.
  </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">optimize</span>:Boolean</code> (default = <code>true</code>)<code></code> &mdash; If true, the compiler will attempt to optimize the
   resulting CompiledFn for speed. At the moment, this just collapses
   constant subtrees of the ParseTree to a single number.
  </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../expr/CompiledFn.html">CompiledFn</a></code></td>
</tr>
</table>
<br>
<span class="label">Throws</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code></code> &mdash; <code>SyntaxError</code>: There was an error
   parsing the given string. The <code>message</code> member of the
   exception contains a human-readable hint at what went wrong.
  </td>
</tr>
</table>
</div>
<a name="compileParseTree()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">compileParseTree</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function compileParseTree(env:<a href="Environment.html">Environment</a>, pt:<a href="datatype/ParseTree.html">ParseTree</a>, optimize:Boolean = true):<a href="../expr/CompiledFn.html">CompiledFn</a></code><p>
  Compile a ParseTree (generated by the Parser) into an evaluable
  CompiledFn.
  </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">env</span>:<a href="Environment.html">Environment</a></code> &mdash; The Environment to use for lookups of functions, operators,
   constants, and variable names.
  </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">pt</span>:<a href="datatype/ParseTree.html">ParseTree</a></code> &mdash; The ParseTree representing the parsed expression to compile.
   This may be generated by <code>Parser.parse()</code>.
  </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">optimize</span>:Boolean</code> (default = <code>true</code>)<code></code> &mdash; If true, attempt to optimize the resulting CompiledFn.
   See the <code>compile</code> method for more details.
  </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../expr/CompiledFn.html">CompiledFn</a></code></td>
</tr>
</table>
<p>
<span class="label">See also</span>
</p>
<div class="seeAlso">
<a href="Parser.html#parse()" target="">Parser.parse()</a>
<br>
<a href="../expr/Compiler.html#compile()" target="">compile()</a>
</div>
</div>
<a name="compileTokenArray()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">compileTokenArray</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function compileTokenArray(env:<a href="Environment.html">Environment</a>, tokens:Array, optimize:Boolean = true):<a href="../expr/CompiledFn.html">CompiledFn</a></code><p>
  Compile an array of Tokens (generated by the Lexer) into an evaluable
  CompiledFn.
  </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">env</span>:<a href="Environment.html">Environment</a></code> &mdash; The Environment to use for lookups of functions, operators,
   constants, and variable names.
  </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">tokens</span>:Array</code> &mdash; An array of Tokens representing the tokenized expression
   to compile. This may be generated by <code>Lexer.lex()</code>.
  </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">optimize</span>:Boolean</code> (default = <code>true</code>)<code></code> &mdash; If true, attempt to optimize the resulting CompiledFn.
   See the <code>compile</code> method for more details.
  </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../expr/CompiledFn.html">CompiledFn</a></code></td>
</tr>
</table>
<br>
<span class="label">Throws</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code></code> &mdash; <code>SyntaxError</code>: There was an error
   parsing the given string. The <code>message</code> member of the
   exception contains a human-readable hint at what went wrong.
  </td>
</tr>
</table>
<p>
<span class="label">See also</span>
</p>
<div class="seeAlso">
<a href="Lexer.html#lex()" target="">Lexer.lex()</a>
<br>
<a href="../expr/Compiler.html#compile()" target="">compile()</a>
</div>
</div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright"> 
</center>
</div>
</body>
</html>
<!-- -->
